package com.qinggeng.project.api.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Lists;
import com.qinggeng.project.system.domain.UserBind;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @author 吴鹏飞
 * @date 2020/10/20
 */
@Data
public class UserBindDto {
    /** 提现绑定用户id*/
    @ApiModelProperty(value = "提现用户id",required = true)
    private Long id;

    /** 用户Id */
    @ApiModelProperty(value = "用户Id",required = true)
    private Long userId;

    /**平台 wx ; alipay*/
    @ApiModelProperty(value = "平台",required = true)
    private String platform;

    /**提现平台为一Id*/
    @ApiModelProperty(value = "提现账户",required = true)
    private String uniqueId;

    /**用户头像*/
    @ApiModelProperty(value = "头像",required = true)
    private String avatar;

    /**用户姓名*/
    @ApiModelProperty(value = "账户名称",required = true)
    private String realUserName;

    /**创建时间*/
    @ApiModelProperty(value = "创建时间",required = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @ApiModelProperty(value = "是否开放",required = true)
    //1开放
    private  String  open;
    @ApiModelProperty(value = "是否绑定",required = true)
    //1绑定 0未绑定
    private String isBind;

    public static List<UserBindDto> newList(List<UserBind> userBinds){
        List<UserBindDto> userBindDtos = Lists.newArrayList();
        if (userBinds!=null && userBinds.size()>0){
            for (UserBind userBind : userBinds) {
                UserBindDto userBindDto = new UserBindDto();
                userBindDto.setUserId(userBind.getUserId());
                userBindDto.setAvatar(userBind.getAvatar());
                userBindDto.setCreateTime(userBind.getCreateTime());
                userBindDto.setId(userBind.getId());
                userBindDto.setPlatform(userBind.getPlatform());
                userBindDto.setRealUserName(userBind.getRealUserName());
                userBindDto.setUniqueId(userBind.getUniqueId());
                userBindDtos.add(userBindDto);
            }
        }
        return userBindDtos;
    }
}
